<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="/WEB-INF/template/common/taglibs.jspf" %>
<es:contentHeader/>
<%@include file="/WEB-INF/template/common/import-zTree-css.jspf" %>

<t:base type="jquery,jquery-ui-bootstrap:bootstrap,jquery-ui-bootstrap:jquery-ui,jquery-ui-bootstrap:font-awesome"></t:base>
<t:base type="jquery-ui-bootstrap:jquery.blockUI,application"></t:base>
<link type="text/css" href="<%=request.getContextPath()%>/resources/css/icon.css?1" rel="stylesheet">
<link type="text/css" href="<%=request.getContextPath()%>/resources/css/theme/theme.blur.css?4" rel="stylesheet">


<ul class="nav nav-tabs">
    <li ${empty param['search.show_eq'] ? 'class="active"' : ''}>
        <a href="<%=request.getContextPath()%>/admin/sys/organization/organization/tree">
            <i class="icon-table"></i>
            所有
            <i class="icon-refresh" title="点击刷新"></i>
        </a>
    </li>
    <li ${not empty param['search.show_eq'] ? 'class="active"' : ''}>
        <a href="<%=request.getContextPath()%>/admin/sys/organization/organization/tree?isShow=true">
            <i class="icon-table"></i>
            显示的
        </a>
    </li>
</ul>

<es:contentFooter/>
<%@include file="/WEB-INF/template/common/import-zTree-js.jspf" %>
<script type="text/javascript">
    var async = ${not empty param.async and param.async eq true};



    $(function () {
        var zNodes = [
            <c:forEach items="${trees}" var="m">
            <%--{ id:${m.id}, pId:${m.pId}, name:"${m.name}", iconSkin:"${m.iconSkin}", open: true, root : ${m.root},isParent:${m.isParent}},--%>
            {id:${m.id}, pId:${m.pId}, name: "${m.name}", iconSkin: "${m.iconSkin}", open: true},
            </c:forEach>
        ];

        $.zTree.initMovableTree({
            zNodes: zNodes,
            urlPrefix: ctx+"/admin/sys/organization/organization",
            async: async,
            onlyDisplayShow:${param['search.show_eq'] eq true},
//            todo
            permission: <es:treePermission resourceIdentity="sys:resource"/>,
            autocomplete: {
                enable: false
            },
            setting: {
                callback: {
                    onClick: function (event, treeId, treeNode, clickFlag) {
                        parent.frames['listFrame'].location.href = ctx + '/admin/sys/organization/organization/' + treeNode.id + "/update?async=" + async;
                    }
                }
            }
        });

    });
</script>